<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<div id="testElement"></div>

<script>

test(function() {
  // TODO(meade): Make this a test case for a property with multiple values when that is supported.
  testElement.attributeStyleMap.set('width', new CSSUnitValue(90, 'px'));
  var result = testElement.attributeStyleMap.getAll('width');
  assert_equals(result.length, 1);
  assert_equals(result[0].toString(), '90px');
}, "getAll() returns a list of values");

test(function() {
  testElement.attributeStyleMap.set('width', new CSSUnitValue(100, 'px'));
  var lowerResult = testElement.attributeStyleMap.getAll('width');
  var upperResult = testElement.attributeStyleMap.getAll('WIDTH');
  var mixedResult = testElement.attributeStyleMap.getAll('wIdTh');

  assert_equals(lowerResult.length, 1);
  assert_equals(upperResult.length, 1);
  assert_equals(mixedResult.length, 1);
  assert_equals(lowerResult[0].toString(), '100px');
  assert_equals(upperResult[0].toString(), '100px');
  assert_equals(mixedResult[0].toString(), '100px');
}, "getAll is case-insensitive for the property name");

test(function() {
  assert_array_equals(testElement.attributeStyleMap.getAll('height'), []);
}, "getAll() returns an empty list if the property isn't set");

test(function() {
  assert_throws_js(TypeError, function() {
    testElement.attributeStyleMap.getAll('lemons');
  });
}, "getAll() throws if you try to get an invalid property");

</script>
